/*  This file is part of the comicconquer project
    Copyright (C) 2010 Reach <reach334@gmail.com>

    ComicConquer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with this software.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef MIST_H
#define MIST_H

//-- include files
#include <QtGui/QtGui>
#include <QtCore/QtCore>

#include "onyx/screen/screen_proxy.h"
#include "onyx/sys/sys.h"
using namespace onyx::screen;
using namespace ui;

//-- version number
#define COCON_VERSION "0.99 beta"

//-- macro substitutions
#define COCLASSNAME metaObject()->className()

//-- global macro funcs
#define CO_MIN(x, y) ((x) < (y) ? (x) : (y))
#define CO_MAX(x, y) ((x) > (y) ? (x) : (y))

#define CO_AR_COUNT(array) (sizeof(array)/sizeof((array)[0]))

//-- constants
#define DEGREE_PER_RADIAN 57.3248f
#define RADIAN_PER_DEGREE 0.0174f

//-- debug control
#define DEBUG_ON // control the log writting
#define DEBUG_FUNC_ON // whether write the function call to log

#define LOG_FILENAME    "log.txt"

#ifdef DEBUG_ON
void Write_Log(const char *str, ...);
void Write_Log(QString str);

    #ifdef DEBUG_FUNC_ON
void In_Log(const char *func, QString objectName = QString());
void Out_Log(const char *func, QString objectName = QString());
    #else
        #define In_Log(...)  
        #define Out_Log(...)  
    #endif

void Open_Log(void);
void Close_Log(void);

#else // DEBUG_ON
// override
    #define Open_Log(...)  
    #define Close_Log(...)  
    #define Write_Log(...)  
    #define In_Log(...)  
    #define Out_Log(...)  
#endif  // DEBUG_ON

//-- global funcs
char* get_exe_path();

#endif  // MIST_H
